﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>编辑物料产品</title>
    <link href="~/libs/layui-v2.9.17/layui/css/layui.css" rel="stylesheet" />
    <script src="~/libs/layui-v2.9.17/layui/layui.js"></script>
    <script src="~/libs/jquery/jquery.js"></script>
</head>
<body>
    <form class="layui-form" action="" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label">物料编码</label>
            <div class="layui-input-block">
                <input type="text" name="itemCode" id="itemCode" lay-verify="required" placeholder="请输入产品物料编码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">物料名称</label>
            <div class="layui-input-block">
                <input type="text" name="itemName" id="itemName" lay-verify="required" placeholder="请输入产品物料名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">规格型号</label>
            <div class="layui-input-block">
                <input type="text" name="specType" id="specType" lay-verify="required" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">库数量</label>
            <div class="layui-input-block">
                <input type="text" name="stockNum" id="stockNum" lay-verify="required" placeholder="请输入在库数量" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单位</label>
            <div class="layui-input-block">
                <input type="text" name="units" id="units" lay-verify="required" placeholder="请输入单位" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">入库批次号</label>
            <div class="layui-input-block">
                <input type="text" name="batchCode" id="batchCode" lay-verify="required" placeholder="请输入入库批次号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">仓库</label>
            <div class="layui-input-block">
                <input type="text" name="warehouseName" id="warehouseName" lay-verify="required" placeholder="请输入仓库" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">库区</label>
            <div class="layui-input-block">
                <input type="text" name="locationName" id="locationName" lay-verify="required" placeholder="请输入库区" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">库位</label>
            <div class="layui-input-block">
                <input type="text" name="areaName" id="areaName" lay-verify="required" placeholder="请输入库位" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">库存有效日期</label>
            <div class="layui-input-block">
                <input type="date" name="expireDate" id="expireDate" lay-verify="required" placeholder="请输入库存有效日期" autocomplete="off" class="layui-input">
            </div>
        </div>
        <input type="hidden" name="id" id="id">
    </form>
    <script type="text/javascript">
        layui.use('form', function () {
            const form = layui.form;
            form.render();
            var id = window.location.search.substring(4);
            $.ajax({
                url: '/ChuBoWen/GetProductEntryForm?id=' + id,
                type: 'get',
                data: $('#form').serialize(),
                success: function (res) {
                    console.log(res);
                    $("#id").val(res.id)
                    $("#itemCode").val(res.itemCode)
                    $("#itemName").val(res.itemName)
                    $("#specType").val(res.specType)
                    $("#stockNum").val(res.stockNum)
                    $("#units").val(res.units)
                    $("#batchCode").val(res.batchCode)
                    $("#warehouseName").val(res.warehouseName)
                    $("#locationName").val(res.locationName)
                    $("#areaName").val(res.areaName)
                    $("#expireDate").val(res.expireDate.substr(0, 10))
                }
            });
        })
    </script>
</body>
</html>